package com.xiaoyu.linkedArray;

/**
 * @program: DS_and_A
 * @description: 链表本链
 * @author: YuWenYi
 * @create: 2021-04-27 08:19
 **/
public class ListNode {
    int val;
    ListNode next;
    ListNode() {}
    ListNode(int val) { this.val = val; }
    ListNode(int val, ListNode next) { this.val = val; this.next = next; }

    public boolean hasNext(){
        return next != null;
    }

    public static void printList(ListNode node){
        while (node.hasNext()){
            System.out.print(node.val+",");
            node = node.next;
        }
        System.out.println(node.val);
    }
}
